Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UL&S: Add TextLinkTableViewCell to SiteAddressViewController #308

Merged
merged 65 commits into from
Jun 25, 2020

Conversation

mindgraffiti
Copy link
Contributor

@mindgraffiti mindgraffiti commented Jun 23, 2020

Ref. #283

This PR refines the code style to be consistent among the new table cells and creates another base UI piece, TextLinkTableViewCell, which is a plain button with text. If only one property is needed on a cell, the variable is made public and the value can be assigned. For more than one property on a cell, a configuration method is created so the different parameters can be passed in.

Concerns: the naming isn't consistent. The thing is a hint button according to the user, but a plain button in interface builder. TextLinkButtonTableViewCell? HintButtonTableViewCell?

To test

  1. bundle exec pod install
  2. Build and run
  3. Test on PR: UL&S: Add TextLinkTableViewCell to SiteAddressViewController WordPress-iOS#14372

Don't allow direct access to IBOutlet properties
It adds the first responder too soon in the view lifecycle
@mindgraffiti
Copy link
Contributor Author

mindgraffiti commented Jun 24, 2020

@ScoutHarris ready for another review. For dynamic text on the button in the TextLinkButtonTableViewCell, I first tried using a text label in a row, then implementing the didSelectRowAt: delegate method. At first none of the touches were firing selected cells, so I added .cancelsTouchesInViews to the NUXBaseViewController, where a background view tap gesture was set. Using this approach created a lag in response times for the iPhone SE (2nd gen) sims. I'm not certain why.

Anyway, TIL that buttons can have dynamic text too. It's not a control that lives in InterfaceBuilder. It has to be set programmatically. It's working now. I also touched up the controls for VoiceOver, though I don't plan on asking reviewers to test that until the whole screen is ready to go.

Found a bug in NUXButton. When the dynamic text shrinks back down, the NUXButtons do not respond to the change. I'll file a bug for it in a bit. Added a comment to #155.

@@ -123,31 +123,57 @@ private extension SiteAddressViewController {
///
func loadRows() {
rows = [.instructions, .siteAddress]
let displayHintButtons = WordPressAuthenticator.shared.configuration.displayHintButtons
if displayHintButtons {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this just be if WordPressAuthenticator.shared.configuration.displayHintButtons {?

///
extension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript (safe index: Index) -> Element? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I missed something, but is this used by anything in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact from trying out a label and setting didSelectRowAt. Will delete!

@ScoutHarris
Copy link
Contributor

Was confused about why CollectionType+AuthHelpers.swift was added. I'll finish the review once that question is answered.

@mindgraffiti mindgraffiti requested a review from ScoutHarris June 25, 2020 13:12
@ScoutHarris
Copy link
Contributor

I only see one issue. With large text on an iPhone (ex: 11 Pro Max), the hint text is truncated. I would expect it to wrap.

iphone_large_text

I figure you might have the same issue with the error label, so I'd be ok with resolving this in a follow up PR. It's up to you, but I think we can consider this GTG assuming that will be fixed later.

@mindgraffiti
Copy link
Contributor Author

Find yo' address 😂 . Thanks for the review! I will make the button text wrap in the next PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants